//
// Created by Jisam on 07/09/2024 7:29 PM.
// Solution of  b
//#pragma GCC optimize(3)
#include <bits/stdc++.h>

using namespace std;
#define endl "\n"
#define PSI pair<string,int>
#define PII pair<int,int>
#define PDI pair<double,int>
#define PDD pair<double,double>
#define VVI vector<vector<int>>
#define VI vector<int>
#define VS vector<string>
#define PQLI priority_queue<int, vector<int>, less<int>>
#define PQGI priority_queue<int, vector<int>, greater<int>>
#define code_by_jisam ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
typedef long long i64;
typedef unsigned u32;
typedef unsigned long long u64;
typedef __int128 i128;
int dx[] = {-1, 1, 0, 0, 1, 1, -1, -1,};
int dy[] = {0, 0, -1, 1, 1, -1, -1, 1,};
struct node{
    int v,w;
};
void solution() {
    int n , V;
    cin >> n >> V;
//    VI v(n + 4),w(n + 4);
//    VI dp(n + 4);
//    VVI dp(n,vector(n,0));
    vector<node> a(n);
    for(int i = 0 ; i < n ; i ++){
//        cin >> v[i] >> w[i];
        cin >> a[i].v >> a[i].w;
    }
    sort(a.begin(), a.end(),[&](node n1,node n2){
        return n1.w * n2.v > n2.w *n1.v;
    });
    int ans = 0;
    for(int i = 0 ; i < n ;i ++){
        if(V - a[i].v >= 0){
            int t = V / a[i].v;
//            cout << a[i].v << " "<<  a[i].w <<endl;
//            cout << ans << " " << V << " " <<t << " " << i << " " <<endl;

            ans += t * a[i].w;
            V -= t * a[i].v;
        }
        if(V == 0) break;
    }
    cout << ans << "\n";
}

int main() {
    code_by_jisam;
    int T = 1;
//    cin >> T;
    while (T--) {
        solution();
    }
    return 0;
}